package com.kuaiyin.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.kuaiyin.enums.Status;
import com.kuaiyin.enums.TestPlanExecMode;
import com.kuaiyin.sampling.BaseVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@Schema(name = "TestPlanVO", description = "测试计划视图对象")
public class TestPlanVO extends BaseVo implements Serializable {

    @Schema(description = "计划ID")
    private Long id;

    @Schema(description = "计划名称（唯一）")
    private String name;

    @Schema(description = "计划描述")
    private String description;

    @Schema(description = "状态：0-禁用 1-启用")
    private Status status;

    @Schema(description = "Cron表达式")
    private String scheduleConfig;

    @Schema(description = "执行模式：STOP_ON_FAIL-错误就停止 CONTINUE_ON_FAIL-错误继续执行")
    private TestPlanExecMode execMode;  // 使用枚举类型

    @Schema(description = "最后一次执行状态")
    private String lastExecutionStatus;

    @Schema(description = "最后一次执行时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime lastExecutionTime;

    @Schema(description = "最后一次执行耗时（秒）")
    private Integer lastExecutionDuration;

    @Schema(description = "关联的用例列表")
    private List<TestPlanCaseVO> cases;
}